\(\int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx\) [238]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 87 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=a b x+\frac {b^2 \text {arctanh}(\sin (c+d x))}{d}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d} \]

[Out]

a*b*x+b^2*arctanh(sin(d*x+c))/d+1/3*(a^2-2*b^2)*sin(d*x+c)/d-1/3*a*b*cos(d*x+c)*sin(d*x+c)/d-1/3*(b+a*cos(d*x+
c))^2*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.37 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.269, Rules used = {4482, 2968, 3129, 3112, 3102, 2814, 3855} \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac {a b \sin (c+d x) \cos (c+d x)}{3 d}-\frac {\sin (c+d x) (a \cos (c+d x)+b)^2}{3 d}+a b x+\frac {b^2 \text {arctanh}(\sin (c+d x))}{d} \]

[In]

Int[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

a*b*x + (b^2*ArcTanh[Sin[c + d*x]])/d + ((a^2 - 2*b^2)*Sin[c + d*x])/(3*d) - (a*b*Cos[c + d*x]*Sin[c + d*x])/(
3*d) - ((b + a*Cos[c + d*x])^2*Sin[c + d*x])/(3*d)

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2968

Int[cos[(e_.) + (f_.)*(x_)]^2*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)
, x_Symbol] :> Int[(d*Sin[e + f*x])^n*(a + b*Sin[e + f*x])^m*(1 - Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f,
 m, n}, x] && NeQ[a^2 - b^2, 0] && (IGtQ[m, 0] || IntegersQ[2*m, 2*n])

Rule 3102

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Dist[1/(
b*(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x],
x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]

Rule 3112

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e
_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a +
 b*Sin[e + f*x])^(m + 1)/(b*f*(m + 3))), x] + Dist[1/(b*(m + 3)), Int[(a + b*Sin[e + f*x])^m*Simp[a*C*d + A*b*
c*(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e
 + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] &&
  !LtQ[m, -1]

Rule 3129

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (C_.)
*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^
(n + 1)/(d*f*(m + n + 2))), x] + Dist[1/(d*(m + n + 2)), Int[(a + b*Sin[e + f*x])^(m - 1)*(c + d*Sin[e + f*x])
^n*Simp[a*A*d*(m + n + 2) + C*(b*c*m + a*d*(n + 1)) + (A*b*d*(m + n + 2) - C*(a*c - b*d*(m + n + 1)))*Sin[e +
f*x] + C*(a*d*m - b*c*(m + 1))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c
- a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[a,
 0] && NeQ[c, 0])))

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int (b+a \cos (c+d x))^2 \sin (c+d x) \tan (c+d x) \, dx \\ & = \int (b+a \cos (c+d x))^2 \left (1-\cos ^2(c+d x)\right ) \sec (c+d x) \, dx \\ & = -\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac {1}{3} \int (b+a \cos (c+d x)) \left (3 b+a \cos (c+d x)-2 b \cos ^2(c+d x)\right ) \sec (c+d x) \, dx \\ & = -\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac {1}{6} \int \left (6 b^2+6 a b \cos (c+d x)+2 \left (a^2-2 b^2\right ) \cos ^2(c+d x)\right ) \sec (c+d x) \, dx \\ & = \frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac {1}{6} \int \left (6 b^2+6 a b \cos (c+d x)\right ) \sec (c+d x) \, dx \\ & = a b x+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+b^2 \int \sec (c+d x) \, dx \\ & = a b x+\frac {b^2 \text {arctanh}(\sin (c+d x))}{d}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac {a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac {(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.52 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.34 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {12 a b c+12 a b d x-12 b^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+12 b^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+3 \left (a^2-4 b^2\right ) \sin (c+d x)-6 a b \sin (2 (c+d x))-a^2 \sin (3 (c+d x))}{12 d} \]

[In]

Integrate[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

(12*a*b*c + 12*a*b*d*x - 12*b^2*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + 12*b^2*Log[Cos[(c + d*x)/2] + Sin[(
c + d*x)/2]] + 3*(a^2 - 4*b^2)*Sin[c + d*x] - 6*a*b*Sin[2*(c + d*x)] - a^2*Sin[3*(c + d*x)])/(12*d)

Maple [A] (verified)

Time = 2.20 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.83

method result size
derivativedivides \(\frac {\frac {a^{2} \sin \left (d x +c \right )^{3}}{3}+2 a b \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(72\)
default \(\frac {\frac {a^{2} \sin \left (d x +c \right )^{3}}{3}+2 a b \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(72\)
risch \(x a b -\frac {i {\mathrm e}^{i \left (d x +c \right )} a^{2}}{8 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b^{2}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{2}}{8 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b^{2}}{2 d}+\frac {b^{2} \ln \left (i+{\mathrm e}^{i \left (d x +c \right )}\right )}{d}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}-\frac {\sin \left (3 d x +3 c \right ) a^{2}}{12 d}-\frac {a b \sin \left (2 d x +2 c \right )}{2 d}\) \(152\)

[In]

int(cos(d*x+c)*(sin(d*x+c)*a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(1/3*a^2*sin(d*x+c)^3+2*a*b*(-1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)+b^2*(-sin(d*x+c)+ln(sec(d*x+c)+tan(
d*x+c))))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 83, normalized size of antiderivative = 0.95 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {6 \, a b d x + 3 \, b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{2} \cos \left (d x + c\right )^{2} + 3 \, a b \cos \left (d x + c\right ) - a^{2} + 3 \, b^{2}\right )} \sin \left (d x + c\right )}{6 \, d} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/6*(6*a*b*d*x + 3*b^2*log(sin(d*x + c) + 1) - 3*b^2*log(-sin(d*x + c) + 1) - 2*(a^2*cos(d*x + c)^2 + 3*a*b*co
s(d*x + c) - a^2 + 3*b^2)*sin(d*x + c))/d

Sympy [F]

\[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))**2,x)

[Out]

Integral((a*sin(c + d*x) + b*tan(c + d*x))**2*cos(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.87 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {2 \, a^{2} \sin \left (d x + c\right )^{3} + 3 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a b + 3 \, b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )}}{6 \, d} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/6*(2*a^2*sin(d*x + c)^3 + 3*(2*d*x + 2*c - sin(2*d*x + 2*c))*a*b + 3*b^2*(log(sin(d*x + c) + 1) - log(sin(d*
x + c) - 1) - 2*sin(d*x + c)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4849 vs. \(2 (81) = 162\).

Time = 2.21 (sec) , antiderivative size = 4849, normalized size of antiderivative = 55.74 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\text {Too large to display} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/12*a^2*sin(3*d*x + 3*c)/d + 1/4*a^2*sin(d*x + c)/d + 1/2*(2*a*b*d*x*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*
tan(c)^2 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2
+ tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*
x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*
c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d
*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*
d*x)^2*tan(1/2*c)^2*tan(c)^2 + 2*a*b*d*x*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*a*b*d*x*tan(d*x)^2*tan(1/2
*d*x)^2*tan(c)^2 + 2*a*b*d*x*tan(d*x)^2*tan(1/2*c)^2*tan(c)^2 + 2*a*b*d*x*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c)^2
 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/
2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + t
an(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*
d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c
) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)
^2 + 2*a*b*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*
d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c
) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*d*x)^2*tan(c)^2 +
 b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*
d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan
(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*d*x)^2*tan(c)^2 + 4*b^2*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)*tan(c)^2 - b^2
*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)
^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2
*c)^2 + 1))*tan(d*x)^2*tan(1/2*c)^2*tan(c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1
/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(
1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*c)^2*tan(c)^2 + 4*b^2*tan(d*x
)^2*tan(1/2*d*x)*tan(1/2*c)^2*tan(c)^2 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c)
+ 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*
x)^2*tan(1/2*c)^2 + tan(1/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*x)^2*tan(1/2*d*x)^2 + 4*b^2*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c) -
b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d
*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(
1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c)
- 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*
x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(1/2*c)^2 + 4*b^2*tan(d*x)^2*tan(1/2*d*x
)*tan(1/2*c)^2 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2
*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(
1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1
/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/
2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*a
*b*tan(d*x)*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*a*b*tan(d*x)^2*tan(1/2*d*x)^2*tan(c) + 2*a*b*tan(d*x)^2*tan(1/2*c)
^2*tan(c) - 2*a*b*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)
^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) +
1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2*tan(c)^2 + b^2*log(2*(tan(1/2
*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)
^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan
(d*x)^2*tan(c)^2 - 4*b^2*tan(d*x)^2*tan(1/2*d*x)*tan(c)^2 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2
*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*
c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(c)^2 + b^2*log(2
*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/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d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)^2 + b
^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*
x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1
/2*c)^2 + 1))*tan(d*x)^2 - 4*b^2*tan(d*x)^2*tan(1/2*d*x) - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*
d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c
) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2 + b^2*log(2*(tan(1/2*
d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^
2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(
1/2*d*x)^2 - 2*a*b*tan(d*x)*tan(1/2*d*x)^2 - 4*b^2*tan(d*x)^2*tan(1/2*c) + 4*b^2*tan(1/2*d*x)^2*tan(1/2*c) - b
^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*
x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1
/2*c)^2 + 1))*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*
d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2
*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*c)^2 - 2*a*b*tan(d*x)*tan(1/2*c)^2 + 4*b^2*tan(1/2*d*x)*ta
n(1/2*c)^2 + 2*a*b*tan(d*x)^2*tan(c) - 2*a*b*tan(1/2*d*x)^2*tan(c) - 2*a*b*tan(1/2*c)^2*tan(c) - b^2*log(2*(ta
n(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1
/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1)
)*tan(c)^2 + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^
2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*
d*x)^2 + tan(1/2*c)^2 + 1))*tan(c)^2 + 2*a*b*tan(d*x)*tan(c)^2 - 4*b^2*tan(1/2*d*x)*tan(c)^2 - 4*b^2*tan(1/2*c
)*tan(c)^2 + 2*a*b*d*x - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)
*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^
2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1)) + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c)
 - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d
*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1)) - 2*a*b*tan(d*x) - 4*b^2*tan(1/2*d*x) - 4*b^2*tan(1/2
*c) - 2*a*b*tan(c))/(d*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c
)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*c)^2*tan(c)^2 + d*tan(1/2*d*x)^2*tan(1/2*c)^
2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2 + d*tan(d*x)^2*tan(1/2*c)^2 + d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(d
*x)^2*tan(c)^2 + d*tan(1/2*d*x)^2*tan(c)^2 + d*tan(1/2*c)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(1/2*d*x)^2 + d*tan
(1/2*c)^2 + d*tan(c)^2 + d)

Mupad [B] (verification not implemented)

Time = 22.84 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.39 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {a^2\,\sin \left (c+d\,x\right )}{4\,d}-\frac {b^2\,\sin \left (c+d\,x\right )}{d}+\frac {2\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {2\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d} \]

[In]

int(cos(c + d*x)*(a*sin(c + d*x) + b*tan(c + d*x))^2,x)

[Out]

(a^2*sin(c + d*x))/(4*d) - (b^2*sin(c + d*x))/d + (2*b^2*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (a^
2*sin(3*c + 3*d*x))/(12*d) + (2*a*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (a*b*sin(2*c + 2*d*x))/(2
*d)